Skip to content

numfmt: implement the last changes#11411

Draft
sylvestre wants to merge 16 commits intouutils:mainfrom
sylvestre:numfmt-2
Draft

numfmt: implement the last changes#11411
sylvestre wants to merge 16 commits intouutils:mainfrom
sylvestre:numfmt-2

Conversation

@sylvestre
Copy link
Contributor

should fix gnu/tests/numfmt/numfmt.pl

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 19, 2026

Merging this PR will improve performance by 24.44%

⚡ 1 improved benchmark
✅ 267 untouched benchmarks
⏩ 78 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation numfmt_padding[(10000, 50)] 47.9 ms 38.5 ms +24.44%

Comparing sylvestre:numfmt-2 (32deeba) with main (ddb9cd6)

Open in CodSpeed

Footnotes

  1. 78 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@sylvestre sylvestre force-pushed the numfmt-2 branch 2 times, most recently from 339ca87 to 524c1b1 Compare March 19, 2026 19:36
@sylvestre
Copy link
Contributor Author

and it passed!
2026-03-19T21:14:50.0513240Z PASS: tests/numfmt/numfmt.pl

Skip GNU numfmt.pl tests not yet supported: unit-sep-22-fail, grp-1,
grp-2, delim-7, field-1, field-range-err-{1-4,6-13}, strtod-6,
strtod-6.1, leading-4, debug-2, devdebug-{1-7,9-11}, help-1,
fmt-err-9, fmt-err-11, fmt-15, ign-err-5, ign-err-m2.2, ign-err-m3.1.

Also unconditionally refresh binary symlinks to avoid stale builds.
…alidation

Fixes GNU numfmt.pl tests: grp-1, grp-2, debug-2, fmt-err-9,
fmt-err-11.
Buffer formatted output so that --invalid=fail does not duplicate lines
on error, and --invalid=abort streams directly for partial output.

Fixes GNU numfmt.pl test: field-3. Re-enables the full numfmt.pl test
suite by removing the skip list added earlier in the stack.
Build the grouped string in a single forward pass using chunk iteration
instead of reversing, inserting separators, then reversing again. This
avoids an extra String allocation and collection.
Remove the trivial single-use helper and simplify split_next_field into
a compact 4-line function.
The two match arms for length 1 and length 2 had identical
RawSuffix::try_from checks. Unify into a single check after a boolean
guard.
Flatten the nested block scope by moving the output trait object and
format dispatch to the same level, reducing indentation.
Use the existing print_warning helper for the grouping-no-effect
message instead of a one-off writeln with util_name(). Use hardcoded
"numfmt:" prefix for the failed-to-convert message to match the other
debug warnings. Remove now-unused util_name import.
GNU test: numfmt.pl fmt-15
GNU test: numfmt.pl devdebug-*, help-1, field-1, field-range-err-*
@sylvestre
Copy link
Contributor Author

@cakebaker i can split it into several if you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants